package edu.zqu.instructionalMatters.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import edu.zqu.instructionalMatters.project.VO.CurriculumVO;
import edu.zqu.instructionalMatters.project.entity.Curriculum;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author 何文东
 * @Date 2020-07-03
 * @Description: 课表 - Mapper 接口
 * @Version 1.0
 */
public interface CurriculumMapper extends BaseMapper<Curriculum> {
    @Select("<script>" + "select curriculum.* from curriculum INNER JOIN calendar on curriculum.calendar_id = calendar.id " +
            " and curriculum.college_id = #{collegeId} " +
            " <if test = 'semesterId != null'>" +
            " and curriculum.semester_id = #{semesterId}" +
            " </if>" +
            " <if test = 'calendarId != null'>" +
            " and curriculum.calendar_id = #{calendarId}" +
            " </if>" +
            " <if test = 'timeTableId != null'>" +
            " and curriculum.time_table_id = #{timeTableId}" +
            " </if>" +
            " <if test = 'courseId != null'>" +
            " and curriculum.course_id = #{courseId}" +
            " </if>" +
            " <if test = 'teacherId != null'>" +
            " and curriculum.teacher_id = #{teacherId}" +
            " </if>" +
            " <if test = 'instructionClassId != null'>" +
            " and curriculum.instructionClass_id = #{instructionClassId}" +
            " </if>" +
            " <if test = 'fieldId != null'>" +
            " and curriculum.field_id = #{fieldId}" +
            " </if>" +
            " <if test = 'calendarDate != null'>" +
            " and calendar.the_date = #{calendarDate}" +
            " </if>" +
            "</script>")
    public List<Curriculum> findAll(CurriculumVO curriculumVO);
}
